package main

import (
	"reflect"
	"fmt"
)

type TT struct {
	A int
	B string
}

func main()  {

	t2 := TT{23, "skidoo"}
	val := reflect.ValueOf(t2)
	ty := reflect.TypeOf(t2)
	fmt.Println(val,ty)
	fmt.Println(val.Kind(),ty.Kind())
	fmt.Println(val.Kind()==reflect.Struct)
	fmt.Println("===========================")

	t := TT{23, "skidoo"}
	s := reflect.ValueOf(&t).Elem()
	s1 := reflect.ValueOf(&t).Kind()
	s2 := reflect.ValueOf(&t)
	fmt.Println(s,s1,s2.Type(),s2,s2.Kind())
	typeOfT := s.Type()
	fmt.Println(typeOfT)

	for i := 0; i < s.NumField(); i++ {
		f := s.Field(i)
		fmt.Printf("%d: %s %s = %v\n", i,
			typeOfT.Field(i).Name, f.Type(), f.Interface())
	}
}
